import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { feedDateDefaultProps } from './defaultProps';
import type { FeedDateOptions } from './type';

export interface FeedDateProps extends FeedDateOptions, HTMLAttributes<HTMLDivElement> {}

const FeedDate: FC<FeedDateProps> = (props) => {
  const { className, children, forwardedRef, ...feedDateProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('date', className), ...feedDateProps },
    children,
  );
};

FeedDate.displayName = 'FeedDate';
FeedDate.defaultProps = feedDateDefaultProps;

export default FeedDate;
